<?php


namespace App\Http\Requests\Manage\System\Dictionary\Index;


use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateRequest extends FormRequest
{
    /**
     * @return array
     * @author luffyzhao@vip.126.com
     */
    public function rules()
    {
        return [
            'code' => ['required', 'alpha_dash', Rule::unique('dictionaries')
                ->ignore($this->route('index'), 'code')],
            'name' => ['required', 'max:255'],
            'element' => ['required', 'max:255', 'array'],
            'element.*.code' => ['required', 'string'],
            'element.*.name' => ['required', 'string'],
        ];
    }
}
